import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/layout'
import Start from '@/views/start'
import Findhouse from '@/views/findhouse'
import Info from '@/views/info'
import My from '@/views/my'
import Login from '@/views/login'
import Register from '@/views/register'
import NotFound from '@/views/notfound'
import Collect from '@/views/collect'
import Manage from '@/views/manage'
import Gotorent from '@/views/gotorent'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/register',
    component: Register
  },
  {
    path: '/collect',
    component: Collect
  },
  {
    path: '/manage',
    component: Manage
  },
  {
    path: '/gotorent',
    component: Gotorent
  },
  {
    path: '*',
    component: NotFound
  },
  {
    path: '/home',
    component: Layout,
    redirect: '/home/findhouse',
    children: [
      {
        path: 'start',
        component: Start
      },
      {
        path: 'findhouse',
        component: Findhouse
      },
      {
        path: 'info',
        component: Info
      },
      {
        path: 'my',
        component: My
      }
    ]
  }

]

const router = new VueRouter({
  routes
})

export default router
